﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Home.Master" AutoEventWireup="true" CodeBehind="ViewProperty.aspx.cs" Inherits="LizzabethBrownRealEstate.Views.Home.ViewProperty" %>
<%@ Import Namespace="LizzabethBrownRealEstate.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ScriptPlaceHolder" runat="server">
    <script type="text/javascript">
    $(function() {
        $('#slideshow').after('<ul id="nav">').cycle({
            fx: 'fade',
            speed:'slow',
            timeout: 0,
            pager:  '#nav',
            pagerAnchorBuilder: function(idx, slide) {
                return '<li><a href="#"><img src="' + slide.src + '" width="50" height="50" /></a></li>';
            }
        });
    });
    </script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StylePlaceHolder" runat="server">
    <style type="text/css">
        #slideshow { margin: 20px }
        #nav { width: 400px; margin: 15px }
        #nav li { width: 50px; float: left; margin: 8px; list-style: none }
        #nav a { width: 50px; padding: 3px; display: block; border: 1px solid #ccc; }
        #nav a.activeSlide { background: #88f }
        #nav a:focus { outline: none; }
        #nav img { border: none; display: block }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <% LBRDataContext dc = new LBRDataContext();  %>
    <% RealEstateProperty p = dc.GetRealEstateProperty(int.Parse(ViewData["PropertyId"].ToString())); %>
    <% if (p == null) p = new RealEstateProperty(); %>
    <% object vals = new {propertyId = p.PropertyId };  %>
    <div class="contentDiv" style="margin-left:20%">
            <fieldset id="fldRegister" style="width:450px;display:block;">
                <legend>New Property</legend>
                <table width="100%">
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label">Location:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.Location.Name %></label></td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="Bathrooms">#&nbsp;of&nbsp;Bathrooms:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.Bathrooms %></label></td>
                        <td class="addPropertyLabel"><label class="label" for="txtFirst">#&nbsp;of&nbsp;Fireplaces:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.Fireplaces %></label></td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="txtLastName">#&nbsp;of&nbsp;Full&nbsp;Baths:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.FullBaths %></label></td>
                        <td class="addPropertyLabel"><label class="label" for="txtPhone">#&nbsp;of&nbsp;Rooms:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.Rooms %></label></td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="txtEmail">Total Living Area:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.TotalLivingArea %></label></td>
                        <td class="addPropertyLabel"><label class="label" for="txtEmail">Total&nbsp;Square&nbsp;Feet:&nbsp;</label></td>    
                        <td class="addPropertyField"><label class="label"><%= p.TotalSquareFeet%></label></td>                    
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="Garg">Has&nbsp;Garage?:&nbsp;</label></td>
                        <td class="addPropertyField"><%= Html.CheckBox("Garage", p.Garage.GetValueOrDefault(), new { disabled = "true" })%></td>
                        <td class="addPropertyLabel"><label class="label" for="GargAttch">Garage&nbsp;Attached?:&nbsp;</label></td>
                        <td class="addPropertyField"><%= Html.CheckBox("GarageAttach", p.GarageAttached.GetValueOrDefault(), new { disabled = "true" })%></td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="Hist">Is&nbsp;Historic:&nbsp;</label></td>
                        <td class="addPropertyField"><%= Html.CheckBox("NewConst", p.Historic.GetValueOrDefault(), new { disabled = "true" })%></td>
                        <td class="addPropertyLabel"><label class="label" for="MLSNumber">MLS&nbsp;Number:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.MLSNumber%></label></td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="txtEmail">Has&nbsp;Basement?:&nbsp;</label></td>
                        <td class="addPropertyField"><%= Html.CheckBox("Bsmnt", p.Basement.GetValueOrDefault(), new { disabled="true" })%></td>
                        <td class="addPropertyLabel"><label class="label" for="txtEmail">New&nbsp;Contstruction?:&nbsp;</label></td>
                        <td class="addPropertyField"><%= Html.CheckBox("NewConst", p.NewConstruction.GetValueOrDefault(), new { disabled="true" })%></td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="Bedrooms">Bedrooms:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= p.Bedrooms%></label></td>
                        <td class="addPropertyLabel"><label class="label" for="Frontage">Total&nbsp;Frontage:&nbsp;</label></td>    
                        <td class="addPropertyField"><label class="label"><%= p.Frontage%></label></td>                    
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="txtEmail">Price:&nbsp;</label></td>
                        <td class="addPropertyField"><label class="label"><%= String.Format("{0:C}",p.Price) %></label></td>
                        <td class="addPropertyLabel">&nbsp;</td>
                        <td class="addPropertyField">&nbsp;</td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td colspan="4"><%= Html.TextArea("Description", p.Description, new { _readonly="true", style="width:100%" })%></td>
                    </tr>
                    
                </table>
            </fieldset>
            <% if (p.PropertyId > 0)
               { %>
            <fieldset id="Fieldset1" style="width:450px;display:block;">
                <legend>Property Photos</legend>
                    <div id="slideshow" class="pics">
                    
                        <% foreach (Photo f in p.Photos.AsEnumerable<Photo>().Where<Photo>(foto => foto.Deleted == false))
                           { %>
                            <img src="../Repository/<%= f.FileName %>" alt="" />
                        <% } %>
                    
                    </div>
            </fieldset>
            <%} %>
            <div>
               <button onclick="window.location='/Home.ashx'">Done</button>
            </div>
    </div>
</asp:Content>
